package com.example.day13;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Lenovo
 */
public class ExceptionDemo {
    public static void main(String[] args) {
        System.out.println("开始");
        try {
            method2();
        }
        catch (ParseException e){
            e.printStackTrace();
        }
        System.out.println("结束");
    }
    public static void method2() throws ParseException {
       String s="2020-01-01";
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
        Date d = sdf.parse(s);
        System.out.println(d);
    }
    public static void method1() throws ArrayIndexOutOfBoundsException {
        int[] arr={1,2,3};
        System.out.println(arr[3]);

    }
}
